<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>测试提交</title>
    <script>
        function submitData() {
            const receiveNumber = document.getElementById("receive_number").value;

            fetch('/submit', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify({ receive_number: receiveNumber })
            })
            .then(response => {
                if (!response.ok) {
                    throw new Error('网络响应异常');
                }
                return response.json();
            })
            .then(data => {
                document.getElementById("message").innerText = data.message;
            })
            .catch(error => {
                document.getElementById("message").innerText = "发生错误: " + error;
            });
        }
    </script>
</head>
<body>
    流水号：<input style="width: 250px" type="text" id="receive_number">
    <button onclick="submitData()">提交</button>

    <!-- 显示结果 -->
    <div id="message" style="margin-top:20px; color:red;"></div>
</body>
</html>
